#pragma	once

#include "ZRoot.h"
#include "ZSocket.h"
#include "ZUtility.h"
#include "ZClock.h"
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <string>
#include <iostream>

namespace	Z	{

//------------------------------------------------------------------------------------------------------------------------
template<typename Derived>
class	Win32Console
{
public:
	void	processCommand();
protected:
	Win32Console();
	virtual	~Win32Console();
	virtual	bool	initialise();
	virtual	void	finalise();
	virtual	bool	handle(char command);
private:
	static	BOOL	consoleCtrlHandler(DWORD dwEvent);
	void	printPrompt();
	bool	startProcessing();
	void	stopProcessing();
private:
	void	process();
	virtual	void	doProcess(float frameTime)	= 0;

private:
	typedef	boost::shared_ptr<Root>	RootPtr;
	RootPtr	mRoot;
	typedef	boost::shared_ptr<boost::thread>	ThreadPtr;
	ThreadPtr	mProcess;
	volatile	bool	mQuit;
};

}

#include "ZWin32Console.inl"